﻿@using WebShop.Infrastructure

@model WebShop.Contracts.Category

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@section scripts
{
    <script src="@Url.Script("jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Script("jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data"}))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Category</legend>

        @Html.HiddenFor(model => model.CategoryID)

        <div class="editor-label">
            @Html.LabelFor(model => model.CategoryName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CategoryName)
            @Html.ValidationMessageFor(model => model.CategoryName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

         <div class="editor-label">
            @Html.LabelFor(model => model.Picture)
        </div>
        <div class="editor-field">
            <!--@Html.EditorFor(model => model.Picture)-->
            @Html.Image("Image", @Model.CategoryID.ToString(), new { @class = "category-image"})
            <br />
            @Html.ImageUpload("Picture")
            @Html.ValidationMessage("Picture", "*")
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
